<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page import="de.pernpas.calendar.entity.Event" %>
<%@page import="de.pernpas.calendar.service.EventService"%>
<%@page import="de.pernpas.calendar.common.CalUtils"%>


<%@page import="de.pernpas.calendar.Navigator"%><html>
<head>
<link type="text/css" rel="stylesheet" href="/css/stylesheet.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Eintrag bearbeiten</title>
</head>
<body>
	<div class="contentContainer marked">
		Eintrag aktualisieren
	</div>
	<%
	CalUtils cu = new CalUtils();
	Event e = EventService.getEvent(request.getParameter("key"));
	%>
	 <form action="/updateEvent" method="post">
		 <div class="contentContainer">
			<div>
				<span class="eventAttributName">Datum:</span> 
				<input type="text" value="<%= cu.getDateString(e.getDate()) %>" name="date"></input>
				<span> (dd.mm.yyyy)</span>
			</div>
			<div>
				<span class="eventAttributName">Name: </span>
				<input type="text" name="name" value="<%= e.getEventName() %>"></input>
			</div>
			<div>
				<span class="eventAttributName">Ort: </span>
				<input type="text" name="location" value="<%= e.getLocation() %>"></input>
			</div>
			<div>
				<span class="eventAttributName">Beschreibung: </span> 
				<textarea rows="10" cols="50" name="description"><%= e.getDescription().getValue() %></textarea>
			</div>	
			<div class="buttonContainer">
				<input class="button" type="submit" value="Aktualisieren"></input>
				
				<% 
				String href = Navigator.getLink(request);
				%>
				<a class="button" href="<%= href %>">Abbrechen</a>
			</div>
			<input type="hidden" name="year" value="<%= request.getParameter("year") %>">
			<input type="hidden" name="month" value="<%= request.getParameter("month") %>">
			<input type="hidden" name="day" value="<%= request.getParameter("day") %>">
			<input type="hidden" name="key" value="<%= e.getKey().getId() %>"></input>
		</div>
	</form>
</body>
</html>